<?php

// uncomment the following to define a path alias
// Yii::setPathOfAlias('local','path/to/local-folder');

// This is the main Web application configuration. Any writable
// CWebApplication properties can be configured here.

return array(
	'basePath'  =>  dirname(__FILE__).DIRECTORY_SEPARATOR.'..',
	'name'      =>  'My Web Application',

	// preloading 'log' component
	'preload'=>array('log'),

	// autoloading model and component classes
	'import'=>array(
		'application.models.*',
		'application.components.*',
	),

	'sourceLanguage'=>'en',
	'language' => 'vi',

	'modules'=>array(
		// uncomment the following to enable the Gii tool
		'gii'=>array(
			'class'=>'system.gii.GiiModule',
			'password'=>'123456',
			// If removed, Gii defaults to localhost only. Edit carefully to taste.
			'ipFilters'=>array('127.0.0.1','::1'),
		),
		'admin' => array(
			'DefaultController' => 'DefaultController'
		),
	),

	// application components
	'components'=>array(

		'request'=>array(
			'enableCookieValidation'=>true,
			'enableCsrfValidation'=>true,
		),
		'user'=>array(
			// enable cookie-based authentication
			'allowAutoLogin'=>true,
		),
		'messages'=>array('basePath'=>Yiibase::getPathOfAlias('application.messages')),
		// uncomment the following to enable URLs in path-format

		'urlManager' => array(
			'urlFormat' => 'path',
			'class'=>  'application.components.UrlManager',
			'showScriptName' => false,
			'urlSuffix' => '.html',
			'rules' => array(
				'<language:([a-z]{2}(?:_[a-z]{2})?)>/' => 'site/index',
				'<language:([a-z]{2}(?:_[a-z]{2})?)>/<action:(contact|login|logout)>/*' => 'site/<action>',
				'<language:([a-z]{2}(?:_[a-z]{2})?)>/<controller:\w+>/<id:\d+>'=>'<controller>/view',
				'<language:([a-z]{2}(?:_[a-z]{2})?)>/<controller:\w+>/<action:\w+>/<id:\d+>'=>'<controller>/<action>',
				'<language:([a-z]{2}(?:_[a-z]{2})?)>/<controller:\w+>/<action:\w+>/*'=>'<controller>/<action>',
				'<controller:\w+>/<id:\d+>' => '<controller>/view',
				'<controller:\w+>/<action:\w+>/<id:\d+>' => '<controller>/<action>',
				'<controller:\w+>/<action:\w+>' => '<controller>/<action>',
				'/<module:\w+>/<controller:\w+>/<action:\w+>/<id:\d+>' => '<module>/<controller>/<action>',
				'/<module:\w+>/<controller:\w+>/<action:\w+>' => '<module>/<controller>/<action>',
				'/<module:\w+>' => '<module>',
			),
		),

		// database settings are configured in database.php
		'db'=>require(dirname(__FILE__).'/database.php'),

		'errorHandler'=>array(
			// use 'site/error' action to display errors
			'errorAction'=>'site/error',
		),

		'log'=>array(
			'class'=>'CLogRouter',
			'routes'=>array(
				array(
					'class'=>'CFileLogRoute',
					'levels'=>'error, warning',
				),
				// uncomment the following to show log messages on web pages
				/*
				array(
					'class'=>'CWebLogRoute',
				),
				*/
			),
		),

	),

	// application-level parameters that can be accessed
	// using Yii::app()->params['paramName']
	'params' => require(dirname(__FILE__).'/'.'params.php')
);
